<!doctype html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <style type="text/css">
      body,html,#container{
        height: 100%;
        margin: 0px;
      }
    </style>
    <title>地图</title>
  </head>
  <body>
    <div id="container" tabindex="0"></div>
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=374d7740e1eb4c1292d299e13006afec"></script>
    <script type="text/javascript">
		document.body.scrollTop = 0;
		if(!navigator.geolocation){
			initMap([116.397428, 39.90923]);
		}else{
			navigator.geolocation.getCurrentPosition(function(position){
				initMap([position.coords.longitude, position.coords.latitude])
			})
		}
		function initMap(center){
			var map = new AMap.Map('container',{
				resizeEnable: true,
				zoom: 10,
				center: center
			});
			AMap.plugin(['AMap.ToolBar','AMap.Scale'], function(){
				map.addControl(new AMap.ToolBar());
				map.addControl(new AMap.Scale());
			});
		}
    </script>
  </body>
</html>